#define _CRT_SECURE_NO_WARNINGS	

/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
typedef struct ListNode ListNode;
int getDecimalValue(struct ListNode* head)
{
    ListNode* pcur = head;
    int sum = 0;
    while (pcur != NULL)
    {
        sum = (sum << 1) + pcur->val;
        pcur = pcur->next;
    }
    return sum;
}